package com.elead.oa.common;

import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import java.io.Serializable;

/**
 * @author xiaozuolin
 * @date 2021/9/27 16:54
 */
@Data
@ApiModel("Json消息封装类")
public class JsonResult implements Serializable {
    @ApiModelProperty(value = "状态")
    private Integer status = 1;
    @ApiModelProperty(value = "消息")
    private String message = "ok";
    @ApiModelProperty(value = "数据")
    private Object data = null;

    private JsonResult() {
    }

    public JsonResult(String message) {
        this.message = message;
    }

    public JsonResult(Object data) {
        this.data = data;
    }

    public JsonResult(Throwable t) {
        this.status = 0;
        this.message = t.getMessage();
    }
}
